clear

*This do file generates maps contained in Figures 1 and 2
*Last updated: May 17, 2022

*Insert your root folder location below
cd  "FOLDER YOUR LOCATION HERE



use "EVRR_Dataset.dta"

list country if wdicode==""
drop if wdicode==""

save "EVRR_Maps.dta", replace
 
keep if year==2020
merge 1:m stateid using "ExtraDatasets/maps_id.dta", nogenerate
gen evrr_dejure_inv = 0
replace evrr_dejure_inv = 1 if evrr_dejure==0
replace evrr_dejure_inv = 1 if evrr_dejure==.
spmap evrr_dejure_inv using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(gs8 white) osize(thin thin) ndsize(thin) legend(off) title("Adoption in 2020")
graph export "Fig1_evrr_dejure_map2020.png", replace width(1280)
spmap evrr_defacto using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs2) osize(thin thin) ndsize(thin) legend(off) title("Implementation in 2020")
graph export "Fig2_evrr_defacto_map2020.png", replace width(1280)
clear
use "EVRR_Maps.dta" 
keep if year==2010
merge 1:m stateid using "ExtraDatasets/maps_id.dta", nogenerate
spmap evrr_dejure using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs8) osize(thin thin) ndsize(thin) legend(off) title("Adoption in 2010")
graph export "Fig1_evrr_dejure_map2010.png", replace width(1280)
spmap evrr_defacto using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs2) osize(thin thin) ndsize(thin) legend(off) title("Implementation in 2010")
graph export "Fig2_evrr_defacto_map2010.png", replace width(1280)
clear
use "EVRR_Maps.dta" 
keep if year==2000
merge 1:m stateid using "ExtraDatasets/maps_id.dta", nogenerate
spmap evrr_dejure using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs8) osize(thin thin) ndsize(thin) legend(off) title("Adoption in 2000")
graph export "Fig1_evrr_dejure_map2000.png", replace width(1280)
spmap evrr_defacto using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs2) osize(thin thin) ndsize(thin) legend(off) title("Implementation in 2000")
graph export "Fig2_evrr_defacto_map2000.png", replace width(1280)
clear
use "EVRR_Maps.dta" 
keep if year==1990
merge 1:m stateid using "ExtraDatasets/maps_id.dta", nogenerate
spmap evrr_dejure using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs8) osize(thin thin) ndsize(thin) legend(off) title("Adoption in 1990")
graph export "Fig1_evrr_dejure_map1990.png", replace width(1280)
spmap evrr_defacto using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs2) osize(thin thin) ndsize(thin) legend(off) title("Implementation in 1990")
graph export "Fig2_evrr_defacto_map1990.png", replace width(1280)
clear
use "EVRR_Maps.dta" 
keep if year==1980
merge 1:m stateid using "ExtraDatasets/maps_id.dta", nogenerate
spmap evrr_dejure using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs8) osize(thin thin) ndsize(thin) legend(off) title("Adoption in 1980")
graph export "Fig1_evrr_dejure_map1980.png", replace width(1280)
spmap evrr_defacto using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs2) osize(thin thin) ndsize(thin) legend(off) title("Implementation in 1980")
graph export "Fig2_evrr_defacto_map1980.png", replace width(1280)
clear
use "EVRR_Maps.dta" 
keep if year==1970
merge 1:m stateid using "ExtraDatasets/maps_id.dta", nogenerate
spmap evrr_dejure using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs8) osize(thin thin) ndsize(thin) legend(off) title("Adoption in 1970")
graph export "Fig1_evrr_dejure_map1970.png", replace width(1280)
spmap evrr_defacto using "ExtraDatasets/coord_mercator_world.dta", id(na_id_world) fcolor(white gs2) osize(thin thin) ndsize(thin) legend(off) title("Implementation in 1970")
graph export "Fig2_evrr_defacto_map1970.png", replace width(1280)
clear

